For more information about block in general and how to create them see the "Creating Blocks for LEGO Mindstorms EV3.html" file that came with this package.
The Sample Sensor returns a random value between 0 and 100. It does not require any hardware and is provided to demonstrate the minimum necessary requirements for a sensor block in the Mindstorms EV3 environment.
A sensor block is different from a data operations block. Sensor blocks automatically plug in to the Loop and Switch structures as well as the Wait block. A typical sensor block has three basic modes (or categories of modes): one for simply reading the sensor value, one for reading the sensor value and comparing it to another value, and one for recognizing changes in the sensor's value. In EV3 shorthand, we refer to these modes as Read, Compare, and Change.
When you have the context help window open and you hover over the Sample Sensor block on a diagram, EV3 automatically generates links to this page based on exactly what your mouse is over. EV3 uses information gathered from the block's two "blocks.xml" files to create these URLs. You access these links by clicking "More Information" within the context help window.
The two blocks.xml files work together. One, which we will refer to as the "Main" blocks.xml is primarily programmatic in nature and serves to define the blocks behaviors and capabilities. It lives in the root directory for the given block. The other is used for mapping the programmatic modes and parameters to user visible strings and to provide context help information for the block. We wil refer to it as the "Strings" block.xml files. It lives in a language specific folder beneath the strings folder in the block's directory.
Each item below is an html anchor or destination targetted by the "More Information" link in the context help window. Instead of describing the particular mode or parameter, we will discuss how each URL was created by the help system.
The link to this section is "http://localhost:58401/localizedMapping_B90BDB05-F70E-4B0B-8CEA-031DCF197215/en-US/editor/page.html?Path=blocks%2fSampleSensor%2fSampleSensor.html#Mode_SampleReadValue".
The important part is the "Path" parameter after the question mark - "blocks/SampleSensor/SampleSensor.html#Mode_SampleReadValue". Let's look at each part of this path.
All blocks are stored in the "blocks" directory. This is located in "<your EV3 install directory>/Resources".
The subfolder "SampleSensor" is named using the "ModuleName" attribute from the "PolyGroups" section in either blocks.xml file (they should be the same). In our case the line reads "<PolyGroups ModuleName="SampleSensor">".
The help file name itself is also derived from the ModuleName, as in <ModuleName>.html.
Finally, the anchor for the mode is built by concatenating "#Mode_" with the value of the "Mode" element for the particular mode within the Main blocks.xml file.
To locate the mode element, consider the following. The Main blocks.html file defines one or more programming blocks. At the highest level there is the "PolyGroups" element and its ModuleName attribute. "SampleSensor" is our ModuleName. All the blocks defined in this file (or Module) get imported, exported, or removed at the same time in the Block Import wizard.
Within the PolyGroups element there can be one or more "PolyGroup" elements. At the user level we refer to these as "blocks" because they are what lives in the palette for us to place on the diagram but internally they are actually collections of blocks called a PolyGroup. Inside a PolyGroup there are one or more "Block" elements, each having a "Mode" element where we define the programmatic name for the given mode. Our basic Measure mode is called "SampleReadValue" thus the help anchor "#Mode_SampleReadValue".
The link to this section is "http://localhost:58401/localizedMapping_B90BDB05-F70E-4B0B-8CEA-031DCF197215/en-US/editor/page.html?Path=blocks%2fSampleSensor%2fSampleSensor.html#Mode_SampleCompareValue".
It was formed using the same recipe as above.
The link to this section is "http://localhost:58401/localizedMapping_B90BDB05-F70E-4B0B-8CEA-031DCF197215/en-US/editor/page.html?Path=blocks%2fSampleSensor%2fSampleSensor.html#Mode_SampleChangeValue".
It was formed using the same recipe as above.
The link to this section is "http://localhost:58401/localizedMapping_B90BDB05-F70E-4B0B-8CEA-031DCF197215/en-US/editor/page.html?Path=blocks%2fSampleSensor%2fSampleSensor.html#Parameters".
EV3 does not form links for individual parameters, instead, all parameters are expected to reside underneath a "Parameters" anchor.
Random Number is the random number returned by our "sensor".
Compare Type, Threshold Value, and Compare Result are the standard parameters for a "Compare" block.
Direction and Amount are standard parameters for a "Change" block.